/**
 * Student class.
 *
 * Class that defines objects of the Student type, extends Person.
 *
 * @author 	David Alvarez Lopez
 * @date	5-Nov-2006
 */

package com.dekaru.misc.person;

public class Student extends Person {
	
	private int idNumber;
	private double grade;

    // ==================
    // CLASS CONSTRUCTORS 
    // ==================
	
	/**
	 * Student empty constructor.
	 *
	 * Constructor to create a Student object using default values.
	 *
	 */
	public Student() {
	
		this.idNumber = 0;
		this.grade = 0d;	
	}

	/**
	 * Student constructor.
	 *
	 * Constructor to create a Student object using the given parameters.
	 *
	 * @param name String
	 * @param idNumber integer
	 * @param grade double.
	 *
	 */
	public Student(String name, int idNumber, double grade) {
	
		super(name);
		this.idNumber = idNumber;
		this.grade = grade;	
	}
	
	/**
	 * Student constructor.
	 *
	 * Constructor to create a Student object using the given parameters.
	 *
	 * @param name String
	 * @param age	integer
	 * @param sex	boolean. True if male, false if female
	 * @param idNumber integer
	 * @param grade double.
	 *
	 */
	public Student(String name, int age, boolean sex, int idNumber, double grade) {
	
		super(name, age, sex);
		this.idNumber = idNumber;
		this.grade = grade;	
	}
	
	// ===================
    // GETTERS, SETTERS... 
    // ===================

	/**
	 * getIdNumber method.
	 *
	 * Method to get the IdNumber of a Student.
	 *
	 * @return idNumber integer.
	 *
	 */
	public int getIdNumber() {
	
		return idNumber;	
	}

	/**
	 * getGrade method.
	 *
	 * Method to get the grade of a Student.
	 *
	 * @return grade double.
	 *
	 */	
	public double getGrade() {
		
		return grade;
	}
	
	/**
	 * setIdNumber method.
	 *
	 * Method to set the IdNumber of a Student.
	 *
	 * @param idNumber integer.
	 *
	 */	
	public void setIdNumber(int idNumber) {
		
		this.idNumber = idNumber;
	}

	/**
	 * setGrade method.
	 *
	 * Method to set the IdNumber of a Student.
	 *
	 * @param idNumber integer.
	 *
	 */	
	public void setGrade(double grade) {
		
		this.grade = grade;
	}


    // ====================
    // OTHER USEFUL METHODS 
    // ====================
	
	/**
	 * equals method.
	 *
	 * Method that checks if the object received as parameter is exactly the same as the Student created.
	 *
	 * @return true if objects are the same, false if they are different.
	 *
	 */	
	public boolean equals(Student obj) {
		
		return (super.equals(obj) && (this.getIdNumber() == obj.getIdNumber()) && (this.getGrade() == obj.getGrade()));
	}
	
	/**
	 * toString method.
	 *
	 * Method to display the data of a Student.
	 *
	 * @return a String with the data of a Student. 
	 *
	 */
	public String toString() {
		
		return super.toString() + " ID No: " + getIdNumber() + ". Grade: " + getGrade();
	}
}